#ifndef _FNT_VIEWER_OPTIONS_H_
#define _FNT_VIEWER_OPTIONS_H_

#include "options.page.h"
#include "color.widget.h"
#include "common.h"
class ViewerPriv;
class QComboBox;
class QSlider;
class QCheckBox;
class ColorWidget;
class ViewerGeneralOptions: public OptionsPage {
	ViewerPriv* vp;
	bool disabled;
	int scaleDef;
	int scaleSet;
	int scaleUsed;
	QComboBox* comboBox;

	ViewerGeneralOptions();
	~ViewerGeneralOptions();

	void getState(bool* a, bool* b, bool* c, bool* d) const override;
	void setStateImp(SessionState ts) override;
	void useDefaultImp() override;
	void saveDefaultImp() override;
	void applyChangesImp() override;
	void resetChangesImp() override;

	static ViewerGeneralOptions* _instance;

	private Q_SLOTS:
		void scaleChanged(int v);

	public:
	void config(ViewerPriv* _vp, Options* options) const;
	void saveConfig(ViewerPriv* _vp, Options* options) const;
	void attach(ViewerPriv* _vp);

	static ViewerGeneralOptions* instance();
};

class ViewerColorOptions: public OptionsPage {
	ViewerPriv* vp;

	QColor colorsSet[COLOR_NUM];
	QColor colorsDef[COLOR_NUM];
	bool colorsNotDef[COLOR_NUM];

	bool colorModeSet;
	bool colorModeDef;

	bool checkedModeSet;
	bool checkedModeDef = true;

	bool disabled;
	bool noupdate;

	QCheckBox* m_differentColorForNeuronsCheckMode;
	QCheckBox* m_NeuronCheckedCheckMode;
	ColorWidget* colorWidgets[COLOR_NUM];

	static ViewerColorOptions* _instance;

	ViewerColorOptions();
	~ViewerColorOptions();

	void getState(bool* a, bool* b, bool* c, bool* d) const override;
	void setStateImp(SessionState ts) override;
	void useDefaultImp() override;
	void saveDefaultImp() override;
	void applyChangesImp() override { }
	void resetChangesImp() override { }

	private Q_SLOTS:
		void checkModeToggled(bool s);
		void neuronCheckedCheckModeToggled(bool s);
	void colorChanged(int i, const QColor& c);

	public:
	void config(ViewerPriv* _vp, Options* options) const;
	void saveConfig(ViewerPriv* _vp, Options* options) const;
	void attach(ViewerPriv* _vp);

	static ViewerColorOptions* instance() {
		if(!_instance)
			_instance=new ViewerColorOptions{};
		return _instance;
	}
};
class ViewerCheckOptions :public OptionsPage {
	ViewerPriv* vp;
	int m_CheckStep;
	int m_CheckStepDef = 5;
	bool m_Disabled;
	QSpinBox* m_StepSpin;
	static ViewerCheckOptions* _instance;

	ViewerCheckOptions();
	~ViewerCheckOptions();

	void getState(bool* a, bool* b, bool* c, bool* d) const override;
	void setStateImp(SessionState ts) override;
	void useDefaultImp() override;
	void saveDefaultImp() override;
	void applyChangesImp() override { }
	void resetChangesImp() override { }
private Q_SLOTS:
	void spinboxChanged(int v);
public:
	void config(ViewerPriv* _vp, Options* options) {}
	void saveConfig(ViewerPriv* _vp, Options* options) {}
	void attach(ViewerPriv* _vp) {}

	static ViewerCheckOptions* instance() {
		if (!_instance)
			_instance = new ViewerCheckOptions{};
		return _instance;
	}
};
class ViewerVolumeOptions: public OptionsPage {
	ViewerPriv* vp; // slice_num_used; slice_shown_used;

	int slice_num_set;
	int slice_num_def;
	int slice_shown_set;
	int slice_shown_def;

	bool disabled;
	bool noupdate;

	QSlider* sliderNum;
	QSlider* sliderShown;

	static ViewerVolumeOptions* _instance;

	ViewerVolumeOptions();
	~ViewerVolumeOptions();

	void getState(bool* a, bool* b, bool* c, bool* d) const override;
	void setStateImp(SessionState ts) override;
	void useDefaultImp() override;
	void saveDefaultImp() override;
	void applyChangesImp() override { }
	void resetChangesImp() override { }

	private Q_SLOTS:
	void sliderNumChanged(int v);
	void sliderShownChanged(int v);

	public:
	void config(ViewerPriv* _vp, Options* options) const;
	void saveConfig(ViewerPriv* _vp, Options* options) const;
	void attach(ViewerPriv* _vp);

	static ViewerVolumeOptions* instance() {
		if(!_instance)
			_instance=new ViewerVolumeOptions{};
		return _instance;
	}
};
// #include "viewer.options.cpp"
#endif
